{
  "properties" : { },
  "id" : "a9c5d3a074a54e769009bb9548c153d9",
  "script" : null,
  "groupId" : "43da313fdeaa495798cf783e6cf83479",
  "name" : "批量删除ip",
  "createTime" : 1727070850329,
  "updateTime" : 1726046009836,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "deleteIpSource",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\r\n    \"groupId\":\"cf9c5daa19a94a58b77c1ce3150fb785\",\r\n    \"ipList\":[\"1.1.1.2\"]\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": true\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  },
  "responseBodyDefinition" : {
    "name" : null,
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }
}
================================
 import org.springblade.core.tool.api.R
 import cn.hutool.core.collection.CollectionUtil

 String groupId = body.groupId;
 List ipList = body.ipList;

 Lis listIpGroup = db.table("ndmp_ip_group").where().eq("parent_id", groupId).select();

 if (!CollectionUtil.isEmpty(listIpGroup)) {
     return R.fail("当前分组不允许删除IP！！！");
 }

 var ipGroup = db.table("ndmp_ip_group").where().eq("id", groupId).selectOne();
 var parentGroupId = ipGroup.get("parentId")
 //将ip重新分配给父分组
 return db.update("""
   update
            ndmp_ip_source_manager
        set  group_id = #{parentGroupId}
        where   ip in
        <foreach collection="ipList" index="index" item="ip" open="(" close=")" separator=",">
            #{ip}
        </foreach>
 """) == 1